import { lazy } from 'react'
import { NotFound, NotAuth, SysError, NoMenu } from 'src/pages/ExceptionPage'
import LazyLoad from './LazyLoad'
import Layout from 'layout'

// 界面路由
const Login = lazy(() => import('pages/Login'))
const LoginCallbackPage = lazy(() => import('pages/Login/CallBackPage'))
// 首页
const Home = lazy(() => import('pages/Home'))
// 用户管理
const UserManage = lazy(() => import('pages/UserManage'))
// 群标签
const GroupTagManage = lazy(() => import('pages/GroupTagManage'))
// 客户管理
const CustomerManage = lazy(() => import('pages/CustomerManage'))
// 流失记录
const LossingCustomer = lazy(() => import('pages/LossingCustomer'))
// 客户群详情
const GroupDetail = lazy(() => import('pages/CustomerGroup/GroupDetail'))
// 客户群管理
const CustomerGroup = lazy(() => import('pages/CustomerGroup'))
// 渠道码
const ChannelCode = lazy(() => import('pages/ChannelCode'))
// 客户旅程
const CustomerJourney = lazy(() => import('pages/CustomerJourney'))
// 在职转接
const IncumbencyTransfer = lazy(() => import('pages/IncumbencyTransfer/index'))
// 离职继承
const DimissionInherit = lazy(() => import('pages/DimissionInherit'))
// 轨迹素材
const TrackMaterial = lazy(() => import('pages/SaleOperations/TrackMaterial'))
// 新增文章
const AddArticlePage = lazy(() =>
  import('pages/SaleOperations/TrackMaterial/Article/AddArticlePage')
)
// 素材标签
const MaterialTags = lazy(() => import('pages/SaleOperations/MaterialTags'))
// 普通素材
const OrdinaryMaterial = lazy(() =>
  import('pages/SaleOperations/OrdinaryMaterial')
)
// 群SOP
const GroupSop = lazy(() => import('pages/TaskManage/GroupSop'))
// sop新增
const GroupSopAddOrEditPage = lazy(() =>
  import('pages/TaskManage/GroupSop/AddOrEditPage')
)
// 客户SOP
const CustomerSop = lazy(() => import('pages/TaskManage/CustomerSop'))
// 新增编辑客户SOP
const CustomerSopAddOrEditPage = lazy(() =>
  import('pages/TaskManage/CustomerSop/AddOrEditPage')
)
// 欢迎语设置
const WelcomeSetting = lazy(() => import('pages/WelcomeSetting'))
// 话术
const TalkScript = lazy(() => import('pages/TalkScript'))
// 管理员列表
const AdminList = lazy(() => import('pages/AdminList'))
// 角色管理
const RoleManage = lazy(() => import('pages/RoleManage'))
// 商机管理
const CommercialOpportunity = lazy(() => import('pages/CommercialOpportunity'))
// 商机管理配置
const CommercialOpportunityConfiguration = lazy(() => import('pages/CommercialOpportunityConfiguration'))
// 销售目标
const SaleTarget = lazy(() => import('pages/SaleTarget'))
// 产品分类
const ProductCategory = lazy(() => import('pages/ProductCategory'))
// 产品列表
const ProductList = lazy(() => import('pages/ProductList'))
// 订单列表
const OrderList = lazy(() => import('pages/OrderList'))

const config = [
  {
    path: '/system-error',
    element: <SysError />,
  },
  {
    path: '/no-auth',
    element: <NotAuth />,
  },
  {
    path: '/login',
    element: <LazyLoad comp={Login} needLogin={false} needAuth={false} />,
  },
  {
    path: '/login-middle',
    element: (
      <LazyLoad comp={LoginCallbackPage} needLogin={false} needAuth={false} />
    ),
  },
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: 'no-menu',
        element: <NoMenu />,
      },
      {
        path: 'home',
        element: <LazyLoad comp={Home} />,
      },
      {
        path: 'userManage',
        element: <LazyLoad comp={UserManage} />,
      },
      {
        path: 'roleMange',
        element: <LazyLoad comp={RoleManage} needAuth={false} />,
      },
      {
        path: 'groupTagManage',
        element: <LazyLoad comp={GroupTagManage} />,
      },
      {
        path: 'customerManage',
        element: <LazyLoad comp={CustomerManage} />,
      },
      {
        path: 'lossingHistory',
        element: <LazyLoad comp={LossingCustomer} />,
      },
      {
        path: 'groupList/detail/:id',
        element: <LazyLoad comp={GroupDetail} />,
      },
      {
        path: 'groupList',
        element: <LazyLoad comp={CustomerGroup} />,
      },
      {
        path: 'channelQrCode',
        element: <LazyLoad comp={ChannelCode} />,
      },
      {
        path: 'customerJourney',
        element: <LazyLoad comp={CustomerJourney} />,
      },
      {
        path: 'incumbencyTransfer',
        element: <LazyLoad comp={IncumbencyTransfer} />,
      },
      {
        path: 'dimissionInherit',
        element: <LazyLoad comp={DimissionInherit} />,
      },
      {
        path: 'saleOperation/trackMaterial',
        element: <LazyLoad comp={TrackMaterial} />,
      },
      {
        path: 'saleOperation/trackMaterial/article/add',
        element: <LazyLoad comp={AddArticlePage} />,
      },
      {
        path: 'saleOperation/trackMaterial/article/edit/:id',
        element: <LazyLoad comp={AddArticlePage} />,
      },
      {
        path: 'saleOperation/materialTags',
        element: <LazyLoad comp={MaterialTags} />,
      },
      {
        path: 'saleOperation/ordinaryMaterial',
        element: <LazyLoad comp={OrdinaryMaterial} />,
      },
      {
        path: 'groupSop/list',
        element: <LazyLoad comp={GroupSop} />,
      },
      {
        path: 'groupSop/list/add',
        element: <LazyLoad comp={GroupSopAddOrEditPage} />,
      },
      {
        path: 'groupSop/list/edit/:id',
        element: <LazyLoad comp={GroupSopAddOrEditPage} />,
      },
      {
        path: 'customerSop/list',
        element: <LazyLoad comp={CustomerSop} />,
      },
      {
        path: 'customerSop/list/add',
        element: <LazyLoad comp={CustomerSopAddOrEditPage} />,
      },
      {
        path: 'customerSop/list/edit/:id',
        element: <LazyLoad comp={CustomerSopAddOrEditPage} />,
      },
      {
        path: 'welcomeSetting',
        element: <LazyLoad comp={WelcomeSetting} />,
      },
      {
        path: 'talkScript',
        element: <LazyLoad comp={TalkScript} />,
      },
      {
        path: 'adminList',
        element: <LazyLoad comp={AdminList} />,
      },
      {
        path: 'commercialOpportunity',
        element: <LazyLoad comp={CommercialOpportunity} />
      },
      {
        path: 'commercialOppConfiguration',
        element: <LazyLoad comp={CommercialOpportunityConfiguration} />
      },
      {
        path: 'saleTarget',
        element: <LazyLoad comp={SaleTarget} />
      },
      {
        path: 'productCategory',
        element: <LazyLoad comp={ProductCategory} />
      },
      {
        path: 'productList',
        element: <LazyLoad comp={ProductList} />
      },
      {
        path: 'orderList',
        element: <LazyLoad comp={OrderList} />
      },
      {
        path: '*',
        element: <NotFound />,
      },
    ],
  },
  { path: '*', element: <NotFound /> },
]
export default config
